package work_b;

import java.io.File;
import java.io.IOException;
import java.util.Scanner;

public class File_text {
    public static void main(String[] args) throws IOException {
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入你的字符串");
        String filePath = sc.next();

show("D:\\file\\itheima\\itcast\\ccc.text");
    }
    public static void show(String filPath) throws IOException {
        File file=new File("D:\\file\\itheima\\itcast\\ccc.text");
       if (!file.exists()){
           file.createNewFile();
       }
       String fileName=file.getName();
        System.out.println(fileName);
       String path=file.getAbsolutePath();
        System.out.println(path);
       String fu=file.getParent();
        System.out.println(fu);
       long size=file.length();
        System.out.println(size);
       int index=fileName.lastIndexOf(".");
        System.out.println(index);
       String name=fileName.substring(index);
        System.out.println(name);
    }

}
